package com.jbit.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder builder){
        RouteLocatorBuilder.Builder routes = builder.routes();
        return routes.route("user",r->
            r.path("/user/**").uri("lb://user-server")
        ).route("function",r->
            r.path("/function/**").uri("lb://user-server")
        ).route("platform",r->
                r.path("/platformConfig/**").uri("lb://user-server")
        ).route("materialProperty",r->
                r.path("/materialProperty/**").uri("lb://user-server")
        ).build();
    }
}
